package com.white.loggerserver.room

import androidx.room.*

/**
 * Created by ytf on 2020/06/08.
 * Description:
 */
@Dao
interface RecordDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun addRecord(rd : Record) : Long

    @Update
    fun updateRecord(rd : Record)

    @Delete
    fun delRecord(rd : Record)

    @Query("delete from ${MyRoomDb.recordTableName} where rid = :rid")
    fun delById(rid : Long)

    @Query("select * from ${MyRoomDb.recordTableName} where title like '%'||:name||'%'")
    fun findByName(name : String) : Record?

    @Query("select * from ${MyRoomDb.recordTableName} order by addTime desc")
    fun getAllRecord() : MutableList<Record>?
}